// src/api/company.js
import apiClient from './index'

export const companyApi = {
    // 企业信息
    registerCompany(companyData) {
        return apiClient.post('/company/register', companyData)
    },

    getCompanyProfile() {
        return apiClient.get('/company/profile')
    },

    updateCompanyProfile(companyData) {
        return apiClient.put('/company/profile', companyData)
    },

    // 提交审核申请
    submitReview() {
        return apiClient.post('/company/submit-review')
    },

    // 实习岗位
    createPosition(positionData) {
        return apiClient.post('/internship-positions', positionData)
    },

    updatePosition(positionId, positionData) {
        return apiClient.put(`/internship-positions/${positionId}`, positionData)
    },

    deletePosition(positionId) {
        return apiClient.delete(`/internship-positions/${positionId}`)
    },

    getMyPositions(params) {
        return apiClient.get('/internship-positions/my', { params })
    },

    // 获取岗位详情
    getPositionDetail(positionId) {
        return apiClient.get(`/internship-positions/${positionId}`)
    },

    togglePositionStatus(positionId) {
        return apiClient.put(`/internship-positions/${positionId}/toggle-status`)
    },

    // 实习申请处理
    getCompanyApplications(params) {
        return apiClient.get('/internship-applications/company', { params })
    },

    // 获取申请详情
    getApplicationDetail(applicationId) {
        return apiClient.get(`/internship-applications/${applicationId}`)
    },

    // 实习申请处理
    processApplication(applicationId, data) {
        // 将数据作为查询参数而不是请求体
        return apiClient.put(`/internship-applications/${applicationId}/process?status=${data.status}`)
    },

    // 实习管理
    getCompanyInternships(params) {
        return apiClient.get('/internships/company', { params })
    },

    // 成绩评定
    evaluateIntern(evaluationData) {
        return apiClient.post('/company/evaluations', evaluationData)
    },

    getEvaluationRecords(params) {
        return apiClient.get('/company/evaluations', { params })
    }
}
